home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / doors / enter / enter.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-26  |  2.2 KB  |  98 lines

  1. #include <exec/exec.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. #include "work:romconf/doorheader.h"
  6. char temp[20];
  7. char Path[200];
  8. char *getlanguage(int i,char *s);
  9. void LastCommand(void);
  10. void end(void);
  11. #define pm prompt
  12. #define sm sendmessage
  13. #define pu putuserstring
  14.  
  15. main(int argc,char *argv[])
  16. {
  17.    char infotext[200];
  18.    char tempfile[200];
  19.    char lang[20];
  20.    register int i;
  21.    int info;
  22.    if(argc!=2)
  23.    {
  24.       printf(".-----------------------------------------------------.\n",1);
  25.       printf("| Ami-Express Enter Version 1.0 Written by ByteMaster |\n");
  26.       printf("|     /X Development Team - The Silent Achievers      |\n");
  27.       printf("`-----------------------------------------------------'\n");
  28.       printf("\n");
  29.       printf(" This is a (XIM) for AmiExpress 2.30+\n");
  30.       printf("\n");
  31.       exit(0);
  32.   }
  33.   Register(argv[1][0]-'0');
  34.   PutInfo(1,DT_ANSICOLOR);
  35.   strcpy(infotext,argv[0]);
  36.  
  37.   do
  38.   {
  39.     pm("ANSI graphics (Y/n/?)? ",temp,5);
  40.     i=0;
  41.     info=FALSE;
  42.     while(i<strlen(temp))
  43.     {
  44.       switch(temp[i])
  45.       {
  46.         case 'N':
  47.         case 'n': PutInfo(0,DT_ANSICOLOR); break;
  48.         case 'q':
  49.         case 'Q': PutInfo(1,DT_QUICKFLAG); break;
  50.         case '?': if(info==FALSE) { info=TRUE; showgfile(infotext);} break;
  51.         case '1':
  52.         case '2':
  53.         case '3':
  54.         case '4':
  55.         case '5':
  56.         case '6':
  57.         case '7':
  58.         case '8':
  59.         case '9': strcpy(lang,getlanguage(temp[i],argv[0])); pu(lang,DT_LANGUAGE); break;
  60.         default:
  61.           if(temp[i]>='a' && temp[i]!='q' && temp[i]!='n' && temp[i]!='y' && temp[i]<'z')
  62.           {  sprintf(tempfile,"%s-%c",Path,temp[i]); showgfile(tempfile); }
  63.           else 
  64.            if(temp[i]>='A' && temp[i]!='Q' && temp[i]!='N' && temp[i]!='Y' && temp[i]<'Z')
  65.           { sprintf(tempfile,"%s-%c",argv[0],temp[i]); showgfile(tempfile); }
  66.       }
  67.       i++;
  68.     }
  69.   }while(info);
  70.   ShutDown();
  71.   end();
  72. }
  73. char *getlanguage(int i,char *s)
  74. {
  75.   char temp[200];
  76.   FILE *fi;
  77.   int j;
  78.   strcpy(temp,s); strcat(temp,".cfg");
  79.   fi=fopen(temp,"r");
  80.   if(fi==NULL) return("");
  81.   j=1;
  82.   while(fgets(temp,80,fi)!=NULL)
  83.   {
  84.     if(j==i) { fclose(fi); return(temp); }
  85.     j++;
  86.   }
  87.   fclose(fi);
  88.   return("");
  89. }
  90. void LastCommand(void)
  91. {
  92.   sm("",1);
  93. }
  94. void end(void)
  95. {
  96.   exit(0);
  97. }
  98.